package graphic.primitives.car;

import graphic.primitives.general.GraphicObject;
import graphic.primitives.general.IGraphicObject;

public class DoorHandle extends GraphicObject implements IGraphicObject
{
	private int breadth;

	public DoorHandle(int x, int y, int breadth){
		this.setXY(x, y);
		this.setBreadth(breadth);
	}

	@Override
	public void redraw(){
		mainWindow.line(x + breadth / 5, y, x + 4*(breadth/5), y); //horejsek kliky
		mainWindow.line(x, y + breadth /6, x+breadth/5, y); // horni roh
		mainWindow.line(x, y+ breadth / 6, x, y + breadth / 3); // stred kliky vlevo
		mainWindow.line(x , y + breadth / 3, x + breadth/5, y+breadth/2 ); // levy spodni roh
		mainWindow.line(x, y+breadth/4,x+breadth, y+breadth/4); //prostredek kliky
		mainWindow.line(x + breadth / 5, y+breadth/2, x + 4*(breadth/5), y+breadth/2); //spodek kliky
		mainWindow.line(x + 4*(breadth/5), y+breadth/2, x + 5*(breadth/5), y + breadth / 3); // pravy dolni roh kliky
		mainWindow.line(x + 5*(breadth/5), y + breadth / 3, x + 5*(breadth/5), y + breadth / 6); // stred kliky v pravo
		mainWindow.line(x + 5*(breadth/5), y + breadth / 6, x + 4*(breadth/5), y ); // horni roh kliky v pravo 
	}

	public int getBreadth() {
		return breadth;
	}

	public final void setBreadth(int breadth) {
		this.breadth = (int)(breadth * 0.1);
	}
}